<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>title</title>
  <!--按顺序引入-->
  <script src="https://cdn.staticfile.org/react/16.8.4/umd/react.development.js"></script>
  <script src="https://cdn.staticfile.org/react-dom/16.8.4/umd/react-dom.development.js"></script>
  <script src="https://cdn.staticfile.org/babel-standalone/6.26.0/babel.min.js"></script>
  <script src="../js/babel.min.js"></script>
  <script src="https://cdn.bootcdn.net/ajax/libs/prop-types/15.8.1/prop-types.js"></script>
  <style>
    body {
      width: 95vw;
      height: 80vh;
      background-color: #2b2b2b;
      color: wheat;
    }
  </style>
</head>
<body>
<div id="app"></div>

<script type="text/babel">
  // 类式组件
  class Person extends React.Component {
    // 静态变量 可通过类名调用 如 Person.propTypes
    static propTypes = {
      name: PropTypes.string.isRequired,
      age: PropTypes.number, // 数字
      sex: PropTypes.string // 字符串
    }
    static defaultProps = {
      sex: '男',
      age: 19
    }

    render() {
      return (
        <ul>
          <li>name: {this.props.name}</li>
          <li>sex: {this.props.sex}</li>
          <li>age: {this.props.age + 1}</li>
        </ul>
      )
    }
  }


  ReactDOM.render(<Person name='Tom'/>, document.getElementById('app'))
</script>
</body>
</html>
